<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('访客预约记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>访客姓名：</label>
                                <input type="text" name="visitorName" placeholder="访客姓名"/>
                            </li>

                            <li>
                                <label>被访人：</label>
                                <input type="text" name="visitedName" placeholder="被访人姓名"/>
                            </li>

                            <li class="select-time">
                                <label>申请时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "visitor/appointment";
        var datas = [[${@dict.getType('approval_status')}]];
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "访客预约记录",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'unionid',
                    title: '预约用户unionid',
                    visible: false
                },
                {
                    field: 'visitorName',
                    title: '访客姓名'
                },
                {
                    field: 'visitorIdcard',
                    title: '访客身份证号'
                },
                {
                    field: 'visitorPhone',
                    title: '访客电话号码'
                },
                {
                    field: 'visitedDept',
                    title: '访问部门'
                },

                {
                    field: 'eta',
                    title: '预计到达时间'
                },
                {
                    field: 'visitedDays',
                    title: '访问天数'
                },
                {
                    field: 'etd',
                    title: '预计离开时间',
                    visible: false
                },
                {
                    field: 'approvalStatus',
                    title: '审批状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'reason',
                    title: '事由'
                },
                {
                    field: 'enterCode',
                    title: '进入码'
                },
                {
                    field: 'enterCodeCheckTime',
                    title: '核验时间'
                },
                {
                    field: 'leaveCode',
                    title: '离开码'
                },
                {
                    field: 'leaveCodeCheckTime',
                    title: '核销时间'
                },
                ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>